'use strict'
let Koa = require('koa');
let body = require('koa-bodyparser');
let nuncon = require('./nuncon'); //! nunjucks配置文件
let control = require('./control'); //@ 控制器文件(路由)
let staticService = require('koa-static');
let session = require('./session/se_index') //? 自定义session文件
let models = require('./models/m_index') //*自定义模型文件
let app = new Koa();


app.use(session(app));
app.use(staticService(__dirname + '/static'));
app.use(staticService(__dirname + '/tools'));
app.use(body());
app.use(nuncon);
app.use(control());

(async() => {
    await models.sync();
})();

app.listen(8889);
console.log('http://127.0.0.1:8889');